package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
    /**
     * 根据菜品id查询套餐
     * @param ids
     * @return
     */
    //select setemeal_id from setemeal_dish where id in(？？？)
    List<Long> getSetmealIdVByDishId(List<Long> ids);

    /**
     * 批量保存套餐和菜品的关联关系
     * @param setmealDishes
     */
    void insertBatch(List<SetmealDish> setmealDishes);

    /**
     *根据id查询菜品
     * @param id
     * @return
     */
    @Select("select *from setmeal_dish where setmeal_id=#{setmealId}")
    List<SetmealDish> getDishsById(Long id);

    /**
     *根据套餐id删除套餐中包含的菜品
     * @param id
     */
    @Delete("delete from setmeal_dish where setmeal_id=#{setmealId}")
    void delete(Long id);

    /**
     * 根据套餐id将套餐包含的菜品停售
     * @param setmealIds
     * @return
     */

    List<Long> getDishIdBySetmealId(List<Long> setmealIds);
}
